// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue';
import Mint from 'mint-ui';
import 'mint-ui/lib/style.css';
import moment from 'moment';
import VuePreview from 'vue-preview';
import '@/assets/global/global.less';
// 注册全局组件
import HomeUl from '@/components/home/HomeUl';
import HomeLi from '@/components/home/HomeLi';
import Comment from '@/components/common/Comment';
import App from './App';
import router from './router';
import store from './store/index';
Vue.config.productionTip = false;

Vue.use(Mint);
// 图片预览插件
Vue.use(VuePreview, {
  shareEl: false, // 配置参数，隐藏分享、下载操作按钮，下载功能操作按钮在分享操作里面
});

// 注册全局组件
Vue.component(HomeUl.name, HomeUl);
Vue.component(HomeLi.name, HomeLi);
Vue.component(Comment.name, Comment);

// 定义全局日期过滤器
moment.locale('zh-cn');
Vue.filter('formatDate', (date, formatStr) => {
  if (formatStr) {
    return moment(date).format(formatStr);
  }
  return moment(date).fromNow();
});

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>',
});
